home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / print / bjfilt.arj / BJFILT.DOC < prev    next >
Text File  |  1994-02-03  |  8KB  |  74 lines

  1.                                      BJFILT.EXE (Version 1.0 Beta)
  2.  
  3. This program has two purposes. The main purpose is to stop the Canon Bubble Jet printer driver(version 1.2) for the BJ200 to stop printing out the extra two letters "ab" at the end of every print job coming from Dos, Winos2, or from a copy <file> lptn command.
  4.  
  5. The second purpose is to provide a parallel port "monitor" which can print out every character sent to the parallel port, for purpose of debugging parallel port problems.
  6. This purpose is independent of the first but once I had figured out how to so the first, the second was easy to do.
  7.  
  8. This code is based on K. Rommel's printmon.exe program which he has supplied with his port of ghostscript to OS2, and thanks must go to him for his guidance through the source he provided. All errors are of course my own.
  9.  
  10. REASON:
  11.  
  12. The Canon bubble jet driver (Version 1.2)  for the BJ200 has a very strange behaviour in that it will print out an extra "ab" at the end of every print job that originates in a Dos or a Windows session, or that originates from doing "copy <file> lpt1" (where I am assuming that lpt1 is the port to which the BJ200 is attached). It does not do this for print jobs sent directly through OS2 ( eg, when you push "PrintScreen" on a desktop window). This behaviour is especially strange because it can be traced to the BJ printer driver sending the sequence 
  13. " Esc ( a 01 Null Null Esc ( b 01 Null Null  Esc @" at the end of the job. (If it comes from the Windows BJ driver there are in fact two of these sequences at the end of the job). What is weird is that exactly the same sequence is at the end of an OS2 print job, where it does not result in the extra "ab" output. This filter simply nulls out everything in this sequence except the "Esc @", which seems to solve the problem. If anyone can understnd the reason for this I would appreciate hearing it.
  14.  
  15. This behaviour is especially annoying because the Canon driver is far faster than the IBM4070 or 4072 drivers which can also run the BJ200.
  16.  
  17. PROGRAM:
  18.  
  19. This program is run by the command
  20.  
  21. <Path>bjfilt  lpt#  [quiet] [monitor] [noreplace]
  22. where <Path> is the path to the location of the program, # is the number of the parallel port to which the bubble jet is attached,  and the words in square brackets are optional. The usual way of running this would be either to type ( assuming the printer is attached to port 1)
  23.  
  24. detach bjfilt lpt1 quiet
  25.  
  26. or to put the line
  27.  
  28. run=c:\spool\bjfilt.exe lpt1 quiet
  29.  
  30. at the end of your config.sys file. (You must give the full path and name of the program in the run command. I am assuming here that the program was installed in the c:\spool directory.) Note that in either of these two cases the only way to kill
  31. the program is to reboot. At least on my system, in neither case does it show up on the process list using pstat, and even the process number reported by detach is claimed to be an invalid number by pstat. 
  32.  
  33. In each case the "quiet" flag is used as you do not want it putting out any output when it is detached. 
  34.  
  35. Other Features.
  36.  
  37. The  two other flags are the "monitor" and the "noreplace" flags. The latter only makes sense in combination with the former, as it disables the replacement of the string that is the purpose of the program. All the "noreplace" flag on its own would do is to slightly slow the printer driver down.
  38.  
  39. The "monitor" flag dumps to the standard output all of the data that it is dumping to the printer. Thus you can see exactly what is being shovelled out the printer port by the BJ driver or by any other driver. With the "noreplace" and "monitor" flags together, this program does nothing to the data sent to the printer, but send a copy of the data to the standard output.  
  40.  
  41. (To be exact, the this program is installed as a "monitor" on the parallel port device driver, with the request that it be installed "last". However each new monitor which requests "last" is placed BEFORE all of the previously installed monitors that requestd "last". Thus it is possible that there are other monitors installed by the system earlier that  modify the data after this one has relesed the data.)
  42.  
  43. The output from the monitor command can be redirected to a file. This again only makes sense if the program is not placed into the background, so that you can kill it with ^C after you have collected sufficient data. One "gotcha" is that although the program flushes the stdout at the end of every print job, the redirection seems to buffer the data. Any of that buffered data not already written to the file when you type is ^C is discarded, rather than flushed out to the file. Thus in general, you will loose the end of the session. To get around this, do a "copy config.sys lpt1" before typing the ^C to make sure that all the data from the job you were interested in got flushed out. [ Is this a bug in the redirection implimentation? ]
  44.  
  45. The final flag is the "quiet" flag. By default, on starting the job, the program prints out its title, and if the options are incorrect it will print out a help screen or an error message. At the beginning of every print job, it will type out the name of the job, and at the end it will type out
  46. a summary- the number of bytes it processed, and the number of times it replaced the filter string. (Windows printouts tend to produce two, while others tend to produce one.) The quiet flag suppresses all of this output.
  47.  
  48. SUMMARY:
  49.  
  50. bjfilt lpt#  [quiet] [monitor] [noreplace]
  51.  
  52. # = Number of the parallel port to which the printer is attached.
  53. quiet = do not "print" out (to the screen) the statistics of each job
  54. monitor=print out (to screen or redirected standard output) every byte processed by the
  55.                      program
  56. noreplace= do not replace the string which produces the "ab". This means the program does
  57.                      nothing unless the monitor flag is also used.
  58.  
  59. SOURCE:
  60. Source code is provided, together with a make file. The program was compiled using the emx port of gcc by Eberhard Mattes, version 0.8h, and using the gnu make utility ported to OS2 by K. Rommel. It does not require the emx runtime libraries.
  61.  
  62. AUTHOR:
  63.     W. G. Unruh 
  64.     unruh@physics.ubc.ca
  65.  
  66. COPYRIGHT:
  67.     For the files bjfilt.c, bjfilt.exe, findstr.c
  68.         W. G. Unruh
  69.     For the files mon16.h, mon16.c
  70.         K. Rommel
  71.  
  72. The programs and the files whose copyright is owned by W. G. Unruh may be  copied, used, and given to others without charge as long as they are not sold or otherwise transfered for any monetary consideration. Except as noted herein, the author, W.  G. Unruh, retains all copyrights for the material he has created. These files may be included in distributions for which a nominal fee for the medium and distribution is charged. This copyright notice is in all cases to remain with the files, and they are to be transmitted unaltered, and with the complete source files as well as the executable file. If alterations are made in any of these files, the author of those alterations is to be clearly identified.
  73.  
  74. DISCLAIMER: The materials included in thsi distribution are provided for the free use of anyone. The author disclaims any and all  liability for any and all damages of any kind caused by this software. All risks are born by the user of this software for any and all damages no matter how caused, and whether direct or consequential. This software is experimental, and if you do not wish to assume any risks involved, do not use it.